<template>
	<div>
		<!-- 调用组件 -->
		<home-header></home-header>
		<home-swiper :SwiperList="SwiperList"></home-swiper>
		<home-icons :iconsList="iconsList"></home-icons>
		<home-hotlist></home-hotlist>
		<home-recommend :RecommendList="RecommendList"></home-recommend>
		<home-hotsuggist :HotSuggistList="HotSuggistList"></home-hotsuggist>
		<home-weekend :WeekendList="WeekendList"></home-weekend>
	</div>
</template>

<script>
	// 引入HomeHeader组件
 import HomeHeader from './components/Header'
 import HomeSwiper from './components/swiper'
 import HomeIcons from './components/icons'
 import HomeRecommend from './components/recommend'
 import HomeHotlist from './components/hotlist'
 import HomeHotsuggist from './components/hotsuggist'
 import HomeWeekend from './components/weekend'



export default {
  name: 'Home',
  data:function () {
  	return{
  		// city:'',
  		SwiperList:[],
  		iconsList:[],
  		RecommendList:[],
  		HotSuggistList:[],
  		WeekendList:[]
  	}
  },
  components: {
	  // 注册组件
	  HomeHeader,
	  HomeSwiper,
	  HomeIcons,
	  HomeRecommend,
	  HomeHotlist,
	  HomeHotsuggist,
	  HomeWeekend
  },
  mounted:function(){
	  // 页面打开就会请求数据
	  this.getHomeInfo()
  },
  methods:{
	  getHomeInfo:function(){
		  this.axios.get('api/index.json')
		  .then(this.getHomeInfoScc)
	  },
	  // 获取到数据
	  getHomeInfoScc(res){
		  // console.log(res)
		  res=res.data
		  // isSuccess后端获取成功返回的标识符
		  // HomeInfo后端获取的数据
		  if(res.isSuccess && res.data){
			const data=res.data
			// this.city=data.city
			this.SwiperList=data.SwiperList
			this.iconsList=data.iconsList
			this.RecommendList=data.RecommendList
			this.HotSuggistList=data.HotSuggistList
			this.WeekendList=data.WeekendList	
		  }
	  }
  }
}
</script>

<style>
</style>
